www.gusucode.com > 24Beta 虚拟主机版 1.0.0 Beta源码程序 > 24Beta 虚拟主机版 1.0.0 Beta源码程序/24Beta-1.0.0-vhost/resource/admin/js/admincp.js

    function deletePost()
{
	var a = confirm('您确定要删除此文章吗?');
	if (!a) return false;
	var tthis = $(this);
	var ptr = tthis.parents('tr');
	var subject = ptr.children('td.post-subject');
	$.ajax({
		url: tthis.attr('href'),
		type: 'post',
		dataType: 'json',
		cache: false,
		success: function(data) {
			subject.prepend('<b class="color-' + ((data.result == 1) ? 'green' : 'red') + '">[' + data.message + ']</a>');
			if (data.result == 1) 
				ptr.fadeOut(1000, function(){$(this).remove()});
			else
				subject.children('.color-red').fadeOut(1500, function(){$(this).remove()});
		}
	});
	return false;
}

function deletePosts()
{
	var a = confirm('您确定要删除这些文章吗?');
	if (!a) return false;
	var chk = $(':checkbox:checked');
	var chkdata = chk.serialize();
	
	$.ajax({
		url: BU + '/admin/post/delete',
		type: 'post',
		dataType: 'json',
		cache: false,
		data: chkdata,
		success: function(data) {
			$('.btnblock').append('<b class="note color-' + ((data.result == 1) ? 'green' : 'red') + '">[' + data.message + ']</a>');
			if (data.result == 1) {
				chk.parents('tr').fadeOut(2000);
			}
			$('.btnblock .note').fadeOut(2000, function(){$(this).remove()});
		}
	});
	return false;
}


function trMouseOver()
{
	$(this).addClass('bg-dark');
}

function trMouseOut()
{
	$(this).removeClass('bg-dark');
}

function selectAll()
{
	$(':checkbox').attr('checked', 'checked');
}

function selectInverse()
{
	var chk = $(':checkbox');
	chk.each(function(){
		var tthis = $(this);
		var ischecked = tthis.attr('checked');
		if (ischecked)
			tthis.removeAttr('checked');
		else
			tthis.attr('checked', 'checked');
	});
}

/****************** category ******************/
function deleteCategory()
{
	var a = confirm('您确定要隐藏此分类吗?');
	if (!a) return false;
	var tthis = $(this);
	var ptr = tthis.parents('tr');
	var subject = ptr.children('td.txt-name');
	$.ajax({
		url: tthis.attr('href'),
		type: 'post',
		dataType: 'json',
		cache: false,
		success: function(data) {
			subject.prepend('<b class="color-' + ((data.result == 1) ? 'green' : 'red') + '">[' + data.message + ']</a>');
			if (data.result == 1) 
				ptr.fadeOut(1000, function(){$(this).remove()});
			else
				subject.children('.color-red').fadeOut(1500, function(){$(this).remove()});
		}
	});
	return false;
}

function deleteUser()
{
	var a = confirm('您确定要删除此用户吗?');
	if (!a) return false;
	var tthis = $(this);
	var ptr = tthis.parents('tr');
	var subject = ptr.children('td.user-name');
	$.ajax({
		url: tthis.attr('href'),
		type: 'post',
		dataType: 'json',
		cache: false,
		success: function(data) {
			subject.prepend('<b class="color-' + ((data.result == 1) ? 'green' : 'red') + '">[' + data.message + ']</a>');
			if (data.result == 1) 
				ptr.fadeOut(1000, function(){$(this).remove()});
			else
				subject.children('.color-red').fadeOut(1500, function(){$(this).remove()});
		}
	});
	return false;
}


function changeState()
{
	var tthis = $(this);
	$.ajax({
		url: tthis.attr('href'),
		type: 'post',
		cache: false,
		dataType: 'json',
		success: function(data) {
			if (data.result == 1 || data.result == 0) {
				var img = BU + '/resource/admin/images/state' + data.result + '.gif';
				tthis.children('img').attr('src', img);
			} else {
				alert(data.message);
			}
		}
	});
	return false;
}

function deleteComment()
{
	var a = confirm('您确定要隐藏此评论吗?');
	if (!a) return false;
	var tthis = $(this);
	var ptr = tthis.parents('tr');
	var subject = ptr.children('td.expand-collapse');
	$.ajax({
		url: tthis.attr('href'),
		type: 'post',
		dataType: 'json',
		cache: false,
		success: function(data) {
			subject.prepend('<b class="color-' + ((data.result == 1) ? 'green' : 'red') + '">[' + data.message + ']</a>');
			if (data.result == 1) {
				ptr.next('tr').fadeOut(500, function(){$(this).remove();});
				ptr.fadeOut(500, function(){$(this).remove();});
			}
			else
				subject.children('.color-red').fadeOut(1500, function(){$(this).remove()});
		}
	});
	return false;
}